package com.example.xinli.domain.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseBean {
    private long code;
    private String message;
    private Object data;

    public static ResponseBean success() {
        return new ResponseBean(ResponseBeanEnum.SUCCESS.getCode(), ResponseBeanEnum.SUCCESS.getMessage(), null);
    }

    public static ResponseBean success(Object obj) {
        return new ResponseBean(ResponseBeanEnum.SUCCESS.getCode(), ResponseBeanEnum.SUCCESS.getMessage(), obj);
    }

    public static ResponseBean error(ResponseBeanEnum resEnum) {
        return new ResponseBean(resEnum.getCode(), resEnum.getMessage(), null);
    }

    public static ResponseBean error(ResponseBeanEnum resEnum, Object obj) {
        return new ResponseBean(resEnum.getCode(), resEnum.getMessage(), obj);
    }
}
